angular.module('Circumference')
    .factory('Circumference.Param', ['$q', function($q) {
        var o = {},
            paramObj = {
                cycle: [],
                magnifierCycle: [],
                weight: {}
            },
            barcode = {},
            users,
            barcodeString,
            actionIndex = 1000;

        o.setParam = function(obj) {
            if (obj.key === 'cycle') {
                paramObj.cycle = obj.value;
            } else if (obj.key === 'magnifierCycle') {
                paramObj.magnifierCycle = obj.value;
            } else if (obj.key === 'weight') {
                paramObj.weight = obj.value;
            }
        };

        o.getParam = function() {
            return paramObj;
        };
        o.clearParam = function() {
            paramObj = {
                cycle: [],
                weight: {},
                magnifierCycle: []
            };
        };

        o.setBarcode = function(v) {
            barcode = v;
        };

        o.getBarcode = function() {
            return barcode;
        };

        o.setBarcodeString = function(v) {
            barcodeString = v;
        };

        o.getBarcodeString = function() {
            return barcodeString;
        };

        o.setUsers = function(v) {
            users = v;
        };

        o.getUsers = function() {
            return users;
        };

        o.setActionIndex = function(index) {
            actionIndex = index;
        };

        o.getActionIndex = function() {
            return actionIndex;
        };

        return o;
    }]);
